nice_things/utility/readlink.sh
readlink
Since 0.3.0 · Source
import "{ readlink }" from nice_things/utility/readlink.sh
Synopsisreadlink [-n] [--] <file>
Configuration
–
Description
Print value of a symbolic link.
This is a sh implementation of the readlink utility specified in POSIX.
Being an implementation of a CLI utility, this function prints the result to stdout. If you want to assign the result to a variable, consider using the faster read_link function instead.
Note
This is not a pure sh implementation because it depends on the external
lsutility to read the target of the symlink. This works consistently because the output oflsis strictly specified in POSIX, but it means this function can be slower than most other functions in the framework.
Options
-n: Do not output a trailing line-feed character.--: End of options.
Operands<file>: Path to a symbolic link.
Stdin
–
Stdout
The result is printed to stdout, trailed by a line-feed character (unless the -n option was used).
Stderrlog_error.
Exit status
0: Successful completion.22:<file>is not a symbolic link.123: Unexpected error.
Abort
–
Usage examples
readlink /path/to/link